package com.learn;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
//@Profile("pro")//当使用pro环境时才会注入此bean，也可以作用在类上
public class MyConfig {

	@Bean
	public Runnable createRunnable(){
		System.out.println("========1==========");
		return ()->{};
	}
	
	@Bean
	@Profile("pro")//当使用pro环境时才会注入此bean
	public Runnable createRunnable2(){
		System.out.println("========2==========");
		return ()->{};
	}
	
	@Bean
	@Profile("dev")//当使用dev环境时才会注入此bean
	public Runnable createRunnable3(){
		System.out.println("========3==========");
		return ()->{};
	}
}
